﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace GameControls
{
    public class GridPainter
    {
        private int _Size;
        private int MAX = 20;

        public GridPainter(int size)
        {
            _Size = size;
        }

        public void OnPaint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Pen pen = new Pen(Color.LightGray, 1);
            
            for (int x = 0; x < _Size * MAX; x += _Size)
            {
                Point p1 = new Point(x, 0);
                Point p2 = new Point(x, _Size * MAX);
                e.Graphics.DrawLine(pen, p1, p2);
            }
            for (int y = 0; y < _Size * MAX; y += _Size)
            {
                Point p1 = new Point(0, y);
                Point p2 = new Point(_Size * MAX, y);
                e.Graphics.DrawLine(pen, p1, p2);
            }
        }
    }
}
